package mylab.base.foundation.orm.ability;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import cn.hutool.db.Db;
import cn.hutool.db.Session;

public interface DS {
    DataSource getDataSource();

    default Db getDb() {
        return Db.use(getDataSource());
    }

    default Connection getConnection() throws SQLException {
        return getDb().getConnection();
    }

    default Session getSession() {
        return Session.create(getDataSource());
    }
}
